import 'package:flutter/material.dart';
import 'package:flutter_im_demo/page/add_friend_list_page.dart';
import 'package:flutter_im_demo/page/add_friend_page.dart';
import 'package:flutter_im_demo/page/image_page.dart';
import 'package:provider/provider.dart';
import 'const_value.dart';
import 'page/home_page.dart';
import 'package:flutter_localizations/flutter_localizations.dart';

import 'page/login_page.dart';
import 'state/global_state.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MultiProvider(
      providers: [
        ChangeNotifierProvider(builder: (_) => GlobalState()),
      ],
      child: MaterialApp(
        locale: Locale('zh', 'CN'),
        localizationsDelegates: [
          GlobalMaterialLocalizations.delegate,
          GlobalWidgetsLocalizations.delegate,
        ],
        supportedLocales: [
          Locale('zh', 'CN'),
        ],
        routes: {
          "login": (context) => LoginPage(),
          "add": (context) => AddFriendPage(),
          "watchImage" : (context) => WatchImagePage(),
          "addList" : (context) => AddFriendListPage(),
        },
        title: 'Flutter Demo',
        theme: ThemeData(
            primarySwatch: Colors.deepPurple,
            primaryColor: color3,
            splashColor: color2),
        home: HomePage(),
      ),
    );
  }
}
